package com.ttt.tank;

import com.ttt.util.MyUtil;

import java.awt.*;

/**
 * 自己的坦克
 */
public class MyTank extends Tank{

    //坦克的图片数组
    private static Image[] tankImg;
    //在静态代码块中对它初始化
    static {
        tankImg = new Image[4];
        tankImg[0] = MyUtil.createImage("images/tankup.png");
        tankImg[1] = MyUtil.createImage("images/tankdown.png");
        tankImg[2] = MyUtil.createImage("images/tankleft.png");
        tankImg[3] = MyUtil.createImage("images/tankright.png");


    }
    public MyTank(int x, int y, int dir) {
        super(x, y, dir);
    }

    @Override
    public void drawImgTank(Graphics g) {
        g.drawImage(tankImg[getDir()],getX() - Radius,getY() - Radius,null);
    }
}
